<?php 

/* Create new object */
$parts = explode(".", $_GET['a']);
$ftype = end($parts);


switch(strtolower($ftype))
{
	case 'jpg':
		$myim = imagecreatefromjpeg( $_GET['a'] );
	break;

	case 'jpeg':
		$myim = imagecreatefromjpeg( $_GET['a'] );
	break;
	
	case 'gif':
		$myim = imagecreatefromgif( $_GET['a'] );
	break;
	
	case 'png':
		$myim = imagecreatefrompng( $_GET['a'] );
	break;
}

$w = imagesx ( $myim );
$h = imagesx ( $myim );
/* Create new image */
$i = 0;
$pixels[0] = 0;

for ($hh=0; $hh < $h; ++$hh) {
	for ($ww=0; $ww < $w; ++$ww) {
		$pixels[$i] = imagecolorat ( $myim , $ww , $hh );	
		//echo 'i: '.$i.' pixel: '.$pixels[i];
		$i++;
	} 

} 
header ("Content-Type:text/xml");

echo '<IMAGE width="'.$w.'" height="'.$h.'" type="'.$ftype.'">';
echo implode("|",$pixels);
echo '</IMAGE>';
die();	
?>